package pl.lodz.p.kipme.entities;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

import pl.lodz.p.kipme.bo.OrderStatus;
import pl.lodz.p.kipme.bo.ProductOrder;

@Table(name = "PRODUCT_ORDER_ENTITIES", uniqueConstraints = { @UniqueConstraint(columnNames = "PRODUCT_ORDER_ID") })
@Entity
public class ProductOrderEntity {

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private Long id;
	@Column(name="PRODUCT_ORDER_ID")
	private String productOrderId;
	@Column(name="PRODUCT_ID")
	private String productId;
	@Column(name="NUMBER_OF_PRODUCTS")
	private int numberOfProduct;
	private OrderStatus status;
    private String comment;
	@ManyToOne
	private OrderEntity order;

	public ProductOrderEntity() {
	}

	public ProductOrderEntity(ProductOrder productOrder,OrderEntity orderEntity) {
		this.numberOfProduct = productOrder.getNumberOfProduct();
		this.productId = productOrder.getProductId();
		this.productOrderId = productOrder.getProductOrderId();
		this.status = productOrder.getStatus();
		this.order = orderEntity;
		this.comment = productOrder.getComment();
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getProductOrderId() {
		return productOrderId;
	}

	public void setProductOrderId(String productOrderId) {
		this.productOrderId = productOrderId;
	}

	public String getProductId() {
		return productId;
	}

	public void setProductId(String productId) {
		this.productId = productId;
	}

	public int getNumberOfProduct() {
		return numberOfProduct;
	}

	public void setNumberOfProduct(int numberOfProduct) {
		this.numberOfProduct = numberOfProduct;
	}

	public OrderStatus getStatus() {
		return status;
	}

	public void setStatus(OrderStatus status) {
		this.status = status;
	}

	public OrderEntity getOrder() {
		return order;
	}

	public void setOrder(OrderEntity order) {
		this.order = order;
	}

    public String getComment() {
        return comment;
    }

    public void setComment(String comment) {
        this.comment = comment;
    }
}
